home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 12.7 KB | 365 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: Studio32.vu
- #
- # Contains: Quick look test script for Studio/32 version 1.20
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.9> 12/14/93 KTA gOpenFileHook2 is now defined as CheckForDiskBuffer()
- # <1.0.8> 12/13/93 KTA ModifyDocuement returns a -1 if the the scrapbbok test fails.
- # <1.0.7> 10/5/93 KTA Added DialogCheck to handle disk buffer dialog that appears
- # sometimes.
- # <1.0.6> 9/30/93 KTA Initialize gFileName prior to gApptitle being updated by
- # launchTwitch().
- # <1.0.5> 9/28/93 KTA Added returnVal for ModifyDocument hook.
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib","DA.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: GS
- # Description: Sets up tools and fonts for Studio/32. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s globals");
- global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal, gTextStr ;
-
- global kToolPaletteNum := 1;
- global kColorPaletteNum := 6;
- global kPatternPaletteNum := 4;
- global kGradientPaletteNum := 5;
- global kLinePaletteNum := 2;
-
- global gPaletteList := {
- {
- {'Tools',18}, #Main Tool Matrix (Pallete #1)
- kPalWind,
- {3,8}, #tool matrix
- {28,20} #tool offset
- },
-
- {
- {26,286, 45,278}, #Pen size popup (Pallete #2)
- kPopUpPal,
- {10,10},
- {13,13}
- },
-
- {
- {66,285, 89,282}, #Zoom in/out popup (Pallete #3)
- kPopUpPal,
- {8,1},
- {18,0}
- },
-
- {
- {43,309, 83,304}, #Patterns (Pallete #4)
- kPopUpPal,
- {13,3},
- {20,17}
- },
-
- {
- {49,329, 92,324}, #Gradient (Pallete #5)
- kPopUpPal,
- {1,2},
- {0,9}
- },
-
- {
- {44,367, 87,346}, #Colors (Pallete #6)
- kPopUpPal,
- {32,8},
- {9,9}
- }
- };
-
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global FreeSelectTool := { 1, 1, "FreeSelect", kMultiDrag, 0, {0} };
- global RectSelectTool := { 2, 1, "RectSelect", kDrag, 0, {0} };
- global WandTool := { 3, 1, "MagicWand", kClick, 0, {0} };
- global CharTool := { 4, 1, "CharTool", kClick, 0, {} };
- global HandTool := { 5, 1, "HandTool", kDrag, 0, {0} };
- global Eraser := { 6, 1, "Eraser", kMultiDrag, 0, {0} };
- global AirBrush := { 7, 1, "AirBrush", kMultiDrag, 0, {1,0,0,1} };
- global PaintBrush := { 8, 1, "PaintBrush", kMultiDrag, 0, {1,1,0,1} };
- global FillTool := { 9, 1, "FillTool", kClick, 0, {1,0,0,1} };
- global BlendTool := {10, 1, "BlendTool", kMultiDrag, 0, {0} };
- global SmudgeTool := {11, 1, "SmudgeTool", kMultiDrag, 0, {0} };
- global CloneBrushTool := {12, 1, "CloneBrush", kMultiDrag, 0, {1,1,0,1} };
- global ColorPickup := {13, 1, "ColorPickup", kClick, 0, {0} };
- global PencilTool := {14, 1, "PencilTool", kMultiDrag, 0, {1,0,0,1} };
- global LineTool := {15, 1, "Line", kDrag, 0, {1,0,1,0} };
- global RectTool := {16, 1, "Rectangle", kDrag, 0, {1,1,1,1} };
- global RndRectTool := {17, 1, "RndRect", kDrag, 0, {1,1,1,1} };
- global OvalTool := {18, 1, "Oval", kDrag, 0, {1,1,1,1} };
- global RotateOvalTool := {19, 1, "RotateOval", kDragClick, 0, {1,1,1,1} };
- global RotatePolygon := {20, 1, "RotatePolygon",kDragClick, 0, {1,1,1,1} };
- #global PolyTool := {21, 1, "Polygon", kMultiClick,1, {1,1,1,1} };
- global FreeTool := {22, 1, "Freehand", kMultiDrag, 0, {1,1,1,1} };
- global CurveTool := {23, 1, "Curve", kDragClick, 0, {1,1,1,1} };
- #global BezTool := {24, 1, "BezTool", kMultiClick,1, {2,1,1,1} };
-
- # VU loses contact w/target when using Poly Tool
-
- #global ColorPickerTool := { 12, 1, "ColorPicker", kClick, 0, {0} };
- #global PenLine := { '', {87,29,1}, "PenLine", 0, 0, {0} };
- #global ZoomOut := { '', {30,-8,2}, "ZoomOut", 0, 0, {0} };
-
- # global Tool list
- global gToolList:={ FreeSelectTool,
- RectSelectTool,
- WandTool,
- #CharTool,
- HandTool,
- Eraser,
- AirBrush,
- PaintBrush,
- FillTool,
- BlendTool,
- SmudgeTool,
- CloneBrushTool,
- ColorPickup,
- PencilTool,
- LineTool,
- RectTool,
- RndRectTool,
- OvalTool,
- RotateOvalTool,
- RotatePolygon,
- #PolyTool,
- FreeTool
- };
-
- ### font characteristic lists
- global gFontSizeList := {'9','10','12','14','18', '24','36','48','72','96'};
- global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow', 'Condense','Extend'};
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain Text"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
-
- global gWindowInset := {10,30,30,30}; # Inset to wind to get content region
-
- global gDoWindowList := {1,1,1,0}; # zooming causes window to disappear in studio/32
-
- end; #InitStudio32Globals
-
- #########################################################################
- # DeselectScrapPaste()
- #========================================================================
- # Author: GS
- # Description: Deselects paste from scrap before calling next routine.
- # Called from DoSetUpApp
- # Parameters: None
- # Returns: Nada
- # Examples: global gSetupScrapText := Task DeselectScrapPaste;
- # Assumptions: Studio/32
- #========================================================================
- # History:
- #
- #########################################################################
- task DeSelectScrapPaste()
- begin
- logstr("Deselecting the selected area...");
- MoveRelativeToWindow(10,25,2,2);
- end;
-
- #########################################################################
- # Studio32ScrapText()
- #========================================================================
- # Author: GS
- # Description: Test scrap text
- # Parameters: None
- # Returns: Nada
- # Assumptions: Studio/32
- #========================================================================
- # History:
- #
- #########################################################################
- Task Studio32ScrapText()
- begin
- scrapbook(global kScrapText);
- DeSelectScrapPaste();
- end;
-
- #########################################################################
- # Studio32Zoom()
- #========================================================================
- # Author: GS
- # Description: Test zooming window
- # Parameters: None
- # Returns: Nada
- # Assumptions: Studio/32
- #========================================================================
- # History:
- #
- #########################################################################
- Task Studio32Zoom()
- begin
- ZoomWindow(); # window disappears
- TypeStr(" "); # to normal mode is press the space bar
- end;
-
- #########################################################################
- # Studio32SetupDoText()
- #========================================================================
- # Author: GS
- # Description: setup dotext
- # Parameters: None
- # Returns: Nada
- # Assumptions: Studio/32
- #========================================================================
- # History:
- #
- #########################################################################
- Task Studio32SetupDoText()
- begin
- logstr("setting up for DoText...");
- Draw(global CharTool); # Select and click with the chartool
- end;
-
- #########################################################################
- # Studio32ModifyDocument()
- #========================================================================
- # Author: ML
- # Description: Modify Studio/32 Document
- # Parameters: None
- # Returns: Nothing
- # Examples: Studio32ModifyDocument();
- # Assumptions: None
- # Applications: Studio/32
- #========================================================================
- # History:
- #
- #########################################################################
- task Studio32ModifyDocument()
- begin
- retVal := Scrapbook(global kScrapTEXT);
- if not(retVal)
- retVal := -1; # ScrapBook failed so can't modifyDoc
- else
- retVal := 1;
-
- return(retVal);
- end;
-
- #########################################################################
- # Studio32SetupDoWindow()
- #========================================================================
- # Author: ML
- # Description: Setup DoWindow in Studio/32
- # Parameters: None
- # Returns: Nothing
- # Examples: Studio32SetupDoWindow();
- # Assumptions: None
- # Applications: Studio/32
- #========================================================================
- # History:
- #
- #########################################################################
- task Studio32SetupDoWindow()
- begin
- if match [window t:'Tools']
- SelectMenuItem("Hide Tools Window","Windows");
- end;
-
- #########################################################################
- # CheckForDiskBuffer()
- #========================================================================
- # Author: KA
- # Description: Check for a dialog that appears when opening files.
- # Parameters: None
- # Returns: Nothing
- # Examples: CheckForDiskBuffer();
- # Assumptions: None
- # Applications: Studio/32
- #========================================================================
- # History:
- #
- #########################################################################
- Task CheckForDiskBuffer()
- begin
- Wait(5);
- DialogCheck("disk buffer",1); # To handle a dialog that may appear
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script Studio32 (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel); # initialize your general globals
- InitDraw();
- InitFonts();
- Global gApptitle := "Studio/32";
- global gAppVersion := '1'; # version of app you will be running
- global gFileName := "@!@-{gBuildVers}-{gAppTitle}"; # This is used in SaveAs when saving files
- Global gLaunchReqs := {'no68K'};
- SuiteStart('Studio32.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
-
- Global gCustomScrapText := Task Studio32ScrapText;
- Global gSetUpForSaveDoc:= Task DeselectScrapPaste;
- global gSetupDoText:= task Studio32SetupDoText; # define app specific task
- global gModifyDocument:= task Studio32ModifyDocument; # define app specific task
- global gSetupDoWindow:= task Studio32SetupDoWindow; # define app specific task
- global gOpenFileHook2 := task CheckForDiskBuffer;
- InitAppGlobals(); # init app specific globals
- (*
- *)
- wait(2);
- DialogCheck("disk buffer",1); # To handle a dialog that may appear
-
- DoSetUpApp(,,,1,1,1,1);
- DoDraw();
- DoText();
- DoWindow();
- Studio32Zoom(); # custom task for Studio/32 zoom test
- DoCloseApp(1,-1);
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script Studio32